package controller.user.order;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import model.VO.OrderVO;
import model.entity.Order;
import service.Impl.OrderServiceImpl;
import util.ResultUtil;

import java.io.IOException;
import java.util.List;

@WebServlet("/user/order/history")
public class OrderHistoryController extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        OrderServiceImpl orderService = new OrderServiceImpl();
        String status=req.getParameter("status");
        List<OrderVO> orderVOList= orderService.list(status);
        String json= ResultUtil.getJSON(orderVOList);
        resp.getWriter().write(json);
    }
}
